package ma.ensao.egicom.core.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.scub.foundation.framework.core.model.BaseModel;


@Entity
@Table(name = "product", schema = "public")
public class Product extends BaseModel {

    /**
     * 
     */
    private static final long serialVersionUID = 1786911400175627586L;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "categoryid", nullable = false)
    private Category category;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplierid", nullable = false)
    private Supplier supplier;

    @Column(name = "label", length = 25)
    private String label;

    @Column(name = "description")
    private String description;

    @Column(name = "image", length = 25)
    private String image;

    @Column(name = "price", precision = 8, scale = 8)
    private Float price;

    @Temporal(TemporalType.DATE)
    @Column(name = "insertiondate", length = 13)
    private Date insertiondate=new Date();

    public Product() {
    }

    public Product(Category category, Supplier supplier) {
        this.category = category;
        this.supplier = supplier;
    }

    public Category getCategory() {
        return this.category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Supplier getSupplier() {
        return this.supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    public String getLabel() {
        return this.label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getImage() {
        return this.image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Float getPrice() {
        return this.price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object other) {
        // TODO Auto-generated method stub
        return false;
    }

    public Date getInsertiondate() {
        return insertiondate;
    }

    public void setInsertiondate(Date insertiondate) {
        this.insertiondate = insertiondate;
    }

}
